import { type Ref, ref, computed } from "vue";
import type { PlusColumn, OptionsRow } from "plus-pro-components";
export function useSearch(pageEnums: Ref<{ [key: string]: OptionsRow[] }>) {
  const searchValues = ref({
    title: "",
    category: "",
    isArchived: false,
    status: ""
  });

  const searchColumns: PlusColumn[] = [
    {
      label: "标题",
      prop: "title"
    },
    {
      label: "分类",
      prop: "category",
      valueType: "select",
      options: computed(() => pageEnums.value.newsCategoryList)
    },
    {
      label: "是否归档",
      prop: "isArchived",
      valueType: "radio",
      options: [
        {
          label: "是",
          value: true
        },
        {
          label: "否",
          value: false
        }
      ]
    },
    {
      label: "状态",
      prop: "status",
      valueType: "select",
      options: []
    }
  ];
  return {
    searchValues,
    searchColumns
  };
}
